﻿using Compass.Maui.Pages.Cargoes;
using Compass.Maui.Pages.FinishGoods;

namespace Compass.Maui.ViewModels;

public partial class MainPageViewModel:BaseViewModel
{
    
    private readonly INavigationService _navigationService;

    public MainPageViewModel(INavigationService navigationService)
    {
        
        _navigationService = navigationService;
    }

    [RelayCommand]
    private async Task GoToAsync(string obj)
    {
        await IsBusyFor(async () =>
        {
            switch (obj)
            {
                case "MainPlans":
                    await _navigationService.NavigateToAsync($"///{nameof(MainPlansPage)}");
                    break;
                case "FinishGoodsCounts":
                    await _navigationService.NavigateToAsync(nameof(FinishGoodsCountsPage));
                    break;
                case "PackingLists":
                    await _navigationService.NavigateToAsync(nameof(PackingListsPage));
                    break;
                case "Warehousing":
                    await _navigationService.NavigateToAsync(nameof(WarehousingPage),
                        new Dictionary<string, object?>
                        {
                            {nameof(PackingListDto),null}
                        });
                    break;
                case "Shipping":
                    await _navigationService.NavigateToAsync(nameof(ShippingPage),
                        new Dictionary<string, object?>
                        {
                            {nameof(PackingListDto),null}
                        });
                    break;

                case "CargoesInquiry":
                    await _navigationService.NavigateToAsync(nameof(CargoesInquiryPage));
                    break;

            }


            
        });
    }


}